package com.dhnsoft.boot.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author dhn
 * @version 1.0
 * @date 2023-08-14 21:50
 * @Desc
 */

@RestController
public class HelloController {

    @Autowired
    StringRedisTemplate redisTemplate;

    @GetMapping("/hello")
    public String hello(){
        return "hello world!";
    }

    @GetMapping("incr")
    public String incr(){
        Long haha = redisTemplate.opsForValue().increment("haha");
        return "增加后的值:"+haha;
    }
}
